home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
amos
/
localext.lha
/
locale_ext
/
locale_ext.doc
< prev
next >
Wrap
Text File
|
1994-04-06
|
9KB
|
261 lines
**** **** ***** ***** ***** *** * * **** ****
* * * * * * * ** * * *
* *** **** *** *** * * * * * * *** ***
* * * * * * * * * ** * * *
*** * * ***** ***** * *** * * *** ****
and Welcome to Locale Extension for AMOSPro
written by Johan Östling (C) Copyright 1994
-------------------------------------------------------
Locale Extension is a set of new commands for AMOSPro
that enables you to use the functions of the new
locale.library present in AmigaDOS version 2.1 or
higher. This library supports multi-lingual facilities
for programs. In other words you can easily let your
program be translated into different languages without
changing the program.
This is a ßeta release - this program is not guaranteed
to be without faults, and have NOT gone through
extensive testing. I actually wrote this for myself to
use, but I have had some requests to release this,
so that's what I am doing.
Permission is hereby granted for unrestricted
NON-commercial use in any of your programs.
The Copyright is retained by Johan Östling (myself).
This extension does NOT require locale.library to
load. Some functions require locale.library and some
functions require AmigaDOS 2.0 or higher. See the
command oversight to see which requires what.
-------------------------------------------------------
INSTALLING
¯¯¯¯¯¯¯¯¯¯
Copy the file Locale.Lib into the drawer where all your
other AMOSPro .Lib files are (usually APSystem). Start
AMOSPro and select 'Set Interpreter' from the 'Config'
menu. Select 'Set Loaded Extensions' and on entry #17,
enter Locale.Lib. Save configuration and restart AMOS.
The extension should now be loaded. You can check this
from the 'About loaded extensions' menu entry.
Make sure that the extension is recorded in entry #17,
otherwise it will not load. I have selected entry #17
because I guess most people does not have anything there.
-------------------------------------------------------
COMMANDS
¯¯¯¯¯¯¯¯
[LOC] :== Requires locale.library
[2.0] :== Requires AmigaDOS 2.0 or higher
Catalog handling commands
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Open Catalog CATALOG_NAME$ , DEFAULT_LANGUAGE$
Open Catalog CATALOG_NAME$ , DEFAULT_LANGUAGE$ , VERSION
Tries to open the named catalog. A catalog is a file containing
a translation of the strings used in your program.
CATALOG_NAME$ contains the name of the catalog.
DEFAULT_LANGUAGE$ names the language the strings built-in in your
program are written in.
VERSION is an optional version number. If this is specified,
the catalog must be exactly this version to be opened.
Example:
Open Catalog "foobar.catalog","english"
Tries to open the catalog 'foobar'. The builtin language is english.
Close Catalog
Closes the currently open catalog. No arguments.
=Catalog String$(ID , DEFAULT_STRING$)
'Translates' the string with id ID. If no translation was found or
if the builtin language is the user's preferred, the string
DEFAULT_STRING$ will be returned.
ID is the id of the string to be translated. All strings must have
an unique id.
DEFAULT_STRING$ is the default, builtin string. You MUST supply this
with a valid string.
=Catalog Active
Simply returns 0 if no catalog is loaded, or <>0 if a catalog is
loaded. If no catalog is loaded then either the builtin language
matches the user's preference, or the user's preferred language
did not have a translation file, or locale.library was not found.
Neither of these errors are fatal - the default strings will be
returned by Catalog String$
Emit Catalog Description FILENAME$ [2.0]
This is a neat function to simplify the creation of a catalog
description file (used when translating a program). Every time
Catalog String$ is called, it will write an entry to the file,
containing the string id and default string.
FILENAME$ is the name of the file to write.
Emit Close
Stops the emitting of catalog description. Note: If the program
is interrupted while emitting a file, the file will still remain
open. Execute an Emit Close command, or exit AMOSPro to close the
file.
Locale Commands
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
=Locale String$(ID) [LOC]
Returns a localized string (defined for the country selected).
ID is an integer higher than 0. To find out what each string is,
try this command out with a FOR loop;
For I=1 To 100
Print I;"=";Locale String$(I)
Next I
This will probably fail when I reach about 50, but then you'll
know. Useful strings are for example localized Yes/No strings.
=Date$ [LOC]
=Time$ [LOC]
=Datetime$ [LOC]
=Short Date$ [LOC]
=Short Time$ [LOC]
=Short Datetime$ [LOC]
Returns a string containg - well guess what.. These dates and
times are in a format supposedly standard for the country you
have selected. The Short xxx$ is also supposed to be shorter
than the others.. It is not so for swedish locale, but you go
ahead and check it out.
=Format Date$(FORMAT$) [LOC]
With this command you can control how the date and time will be
displayed.
FORMAT$ is a formatting string describing how the date and time
will be displayed. The commands are;
%a - abbreviated weekday name
%A - weekday name
%b - abbreviated month name
%B - month name
%c - same as "%a %b %d %H:%M:%S %Y"
%C - same as "%a %b %e %T %Z %Y"
%d - day number with leading 0s
%D - same as "%m/%d/%y"
%e - day number with leading spaces
%h - abbreviated month name
%H - hour using 24-hour style
%I - hour using 12-hour style
%j - julian date
%m - month number with leading 0s
%M - the number of minutes with leading 0s
%n - insert a linefeed
%p - AM or PM strings
%r - same as "%I:%M:%S %p"
%R - same as "%H:%M"
%S - number of seconds with leadings 0s
%t - insert a tab character
%T - same as "%H:%M:%S"
%U - week number, taking Sunday as first day of week
%w - weekday number
%W - week number, taking Monday as first day of week
%x - same as "%m/%d/%y"
%X - same as "%H:%M:%S"
%y - year using two digits with leading 0s
%Y - year using four digits with leading 0s
For example:
Print Format Date$("The time is %r and the month is %B")
=Locale Active
Checks to see if a locale is loaded. You can use this function to
exit gracefully if you intend to use any Locale commands;
If Locale Active=0
Print "I'm sorry, but you need locale.library for this program"
End
End If
=Locale Compare(STRING1$ , STRING2$) [LOC]
=Locale Compare(STRING1$ , STRING2$ , LEVEL) [LOC]
Compares the two strings and returns:
<0 if STRING1$<STRING2$
=0 if STRING1$=STRING2$
>0 if STRING1$>STRING2$
LEVEL specifies the level of comparing:
0 - ordinary compare. You could skip this function and use a
straight If STRING1$=STRING2$ instead..
1 - locale light :) Does not make any difference between é and e
for example.
2 - locale standard. Will place é before f, but not equal to e.
Note: This seems like a good function, but it is bugged. Not in my
extension though, but in the system. The swedish characters åäö,
which _should_ be last in the swedish alphabet, is instead sorted
in like this: å=ä=a and ö=o. This may be good for some languages.
But not for swedish. Now you know.
=Locale Lower$(STRING$) [LOC]
=Locale Upper$(STRING$) [LOC]
Works just like AMOS' normal Upper$ and Lower$, but converts
letters like å or æ or é correctly.
STRING$ is the string to convert
=Lowerchar(CHAR) [LOC]
=Upperchar(CHAR) [LOC]
This returns the ASCII value of the converted character. I can't
see much use for these function really, but they were real easy
to provide :)
CHAR is character to convert.
For example:
Print Chr$(Upperchar(Asc("a"))
is a silly way to write
Print Locale Upper$("a")
--------------------------------------------------------------------
That's it. I can hope that you find a use for this program.
And please, if you find any bugs, write to me about them. Or
if you just have any comments, or anything. This is where
you can get in touch with me: (I prefer Emails..)
Email:
e92_jog@e.kth.se
Snailmail:
Johan Östling
Sköndalsv. 114
128 68 Sköndal
Sweden
if you wish a reply by snailmail, include a self-adressed envelope,
and I'll try to reply.